package io.gitee.geminidev.bot;

/**
 * @Author gemini
 * @Date 2023/4/5 12:47
 * @description: 上下文
 */
public class BotContext {

    /** BotAppID（开发者ID） */
    private String botAppId;
    /** 机器人令牌 */
    private String botToken;
    /** 沙箱支持，可选，默认false */
    private boolean sandbox;

    public String getToken(){
        return String.format("Bot %s.%s", botAppId, botToken);
    }

    public String getHttpUri(){
        return isSandbox() ? "https://sandbox.api.sgroup.qq.com" : "https://api.sgroup.qq.com";
    }

    public String getWssUri(){
        return isSandbox() ? "wss://sandbox.api.sgroup.qq.com/websocket/" : "wss://api.sgroup.qq.com/websocket/";
    }

    public String getBotAppId() {
        return botAppId;
    }

    protected void setBotAppId(String botAppId) {
        this.botAppId = botAppId;
    }

    public String getBotToken() {
        return botToken;
    }

    protected void setBotToken(String botToken) {
        this.botToken = botToken;
    }

    public boolean isSandbox() {
        return sandbox;
    }

    public void setSandbox(boolean sandbox) {
        this.sandbox = sandbox;
    }


}
